package com.util;

import java.security.interfaces.RSAKey;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.po.User;


public class JdbcUtils {
	
	public JdbcUtils(String userName, String userPassword) throws ClassNotFoundException, SQLException {
		Connection conn = null;
		Statement st = null;
		ResultSet rs = null;
		try {
			Class.forName("org.gjt.mm.mysql.Driver");
			conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mvc","root","1234");
			st = conn.createStatement();
			rs = st.executeQuery("select userName, userPassword from user_ where userName = '" + userName
					+"' and userPassword = '" + userPassword + "'");
			while (rs.next()) {
				User user = new User();
				user.setUserName(rs.getString(userName));
				user.setUserName(rs.getString(userPassword));
			}
		} finally {
			try {
				if (null != rs) {
					rs.close();
				}
			} finally {
				try {
					if (null != st) {
						st.close();
					}
				} finally {
					if (null != conn) {
						conn.close();
					}
				}
			}
		}
	}
}
